# 预习 装饰器
# 写一个装饰器，用来统计任何函数的运行时间
import time


def cal_time(func):
    def sum_time(*args, **kwargs):
        a = time.time()
        func(*args, **kwargs)
        b = time.time() - a
        print(b)

    return sum_time


@cal_time
def f():
    time.sleep(1)
    print("do something ...")


print(f())
